package com.wudd.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wudd.common.bean.response.ResponseVO;
import com.wudd.entity.dto.OrderInfoDto;
import com.wudd.service.OrderInfoService;

@RestController
@RequestMapping("/orderInfo")
public class OrderInfoController {
	@Autowired
	private OrderInfoService orderInfoService;
	
	@RequestMapping("/addOrderInfo")
	public ResponseVO<Integer> addOrderInfo(){
		int num = orderInfoService.addOrderInfo();
		return ResponseVO.successWithData(num);
	}	
	
	/**
	 * 校验接受参数，抛出异常并捕获代码示例
	 * @param orderInfo
	 * @return
	 */
	@RequestMapping("/updateOrderInfo")
	public ResponseVO<Integer> updateOrderInfo(@Validated OrderInfoDto orderInfo){
		int num = orderInfoService.updateOrderInfo(orderInfo);
		return ResponseVO.successWithData(num);
	}
}
